/**
 * Copyright © 2020 易久批信息技术有限公司. All rights reserved.
 */
package com.dysm.observer;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author xiayang
 * @since 2020/12/17 1:59 下午
 */
public class Subject {

    protected List<Observer> observerList = new ArrayList<>();

    public void register(Observer observer) {
        observerList.add(observer);
    }

    public void notifyAllObserver() {
        for (Observer observer : observerList) {
            observer.update(this);
        }
    }
}
